package com.rgzn.chapter3_3.dao;

import com.rgzn.chapter3_3.entity.User;
import org.apache.ibatis.annotations.*;


@Mapper
public interface UserDao {
    @Results(id = "userMap",value = {
            @Result(property = "name",column = "username"),
            @Result(property = "sex",column = "sex"),
            @Result(property = "password",column = "password")
    })
    @Select("select * from user where username = #{username} and password = #{password}")
    User getUserByName(@Param("username") String name,String password);

    @Select("select count(1) from user where username = #{name}")
    int findUserByName(User user);

    @Insert("insert into user(username,password,sex) values (#{name},#{password},#{sex})")
    int creatUser(User user);
}
